package org.cshoo.sys.command
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	
	import mx.controls.Alert;
	import mx.rpc.IResponder;
	import mx.rpc.events.ResultEvent;
	
	import org.cshoo.sys.business.UserDelegate;
	import org.cshoo.sys.event.AddUserEvent;
	import org.cshoo.sys.model.vo.User;
	public class AddUserCommand implements ICommand, IResponder
	{
		public function execute(event:CairngormEvent):void
		{
			var user:User = (event as AddUserEvent).user;
			var userDelegate:UserDelegate = new UserDelegate(this);
			userDelegate.addUser(user);
		}
		
		public function result(event:Object):void
		{
			if((event as ResultEvent).result as Boolean)
				Alert.show("用户添加成功");
			else
				Alert.show("用户添加失败");
		}
		
		public function fault(info:Object):void
		{
			Alert.show("无法连接");
		}
	}
}